package log4j2test;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.core.config.Configurator;

import java.io.IOException;

/**
 * @author      : yang.xp
 * @date        : 2021/9/18 11:46
 * @description : 测试停服是否会打印日志
 */
public class PrintLogTest {

    public static final Logger dcGameServerLog = LogManager.getLogger(PrintLogTest.class);

    public static void main(String[] args) {
        Configurator.initialize("Log4j2", "config/log4j2.xml");
        dcGameServerLog.info("【PrintLogTest begin start】");

        Runtime.getRuntime().addShutdownHook(new Thread(() -> {
            dcGameServerLog.info("【LogicServer begin close】");
            dcGameServerLog.error("PrintLogTest error ============================================================ ");
        }));
        try {
            System.in.read();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
